#include "laneitem.h"

LaneItem::LaneItem(QObject *parent) : QObject(parent)
{
    setPen(Qt::NoPen);
    setAcceptHoverEvents(true);
}

void LaneItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
{
    painter->setRenderHint(QPainter::Antialiasing);
    QGraphicsPolygonItem::paint(painter, option, widget);
}

void LaneItem::mousePressEvent(QGraphicsSceneMouseEvent *event)
{
    emit sigClick();
}

void LaneItem::hoverMoveEvent(QGraphicsSceneHoverEvent *event)
{
    emit sigLane(this, event->pos());
}

double LaneItem::getLaneSectionS() const
{
    return m_dLaneSectionS;
}

void LaneItem::setLaneSectionS(double dLaneSectionS)
{
    m_dLaneSectionS = dLaneSectionS;
}

Height LaneItem::getLaneHeight() const
{
    return m_height;
}

void LaneItem::setLaneHeight(const Height &height)
{
    m_height = height;
}

SGeometry LaneItem::getGeometry() const
{
    return m_geometry;
}

void LaneItem::setGeometry(const SGeometry &geometry)
{
    m_geometry = geometry;
}

void LaneItem::appendWidth(int iId, const Width &width)
{
    m_qmapWidth.insert(iId, width);
}

Width LaneItem::getWidth(int iId)
{
    return m_qmapWidth.value(iId);
}

QString LaneItem::getRoadMarkColor() const
{
    return m_qstrRoadMarkColor;
}

QString LaneItem::getRoadMarkType() const
{
    return m_qstrRoadMarkType;
}

QString LaneItem::getLaneType() const
{
    return m_qstrLaneType;
}

void LaneItem::setRoadMarkColor(const QString &qstrRoadMarkColor)
{
    m_qstrRoadMarkColor = qstrRoadMarkColor;
}

void LaneItem::setRoadMarkType(const QString &qstrRoadMarkType)
{
    m_qstrRoadMarkType = qstrRoadMarkType;
}

void LaneItem::setLaneType(const QString &qstrLaneType)
{
    m_qstrLaneType = qstrLaneType;
    //setBrush(getColor(qstrLaneType));
}

QString LaneItem::getId() const
{
    return m_qstrId;
}

void LaneItem::setId(const QString &qstrId)
{
    m_qstrId = qstrId;
}

const SLaneSection &LaneItem::getLaneSection() const
{
    return m_laneSection;
}

void LaneItem::setLaneSection(const SLaneSection &laneSection)
{
    m_laneSection = laneSection;
}

std::string LaneItem::getRoadId() const
{
    return m_qstrRoadId;
}

void LaneItem::setRoadId(const std::string &qstrRoadId)
{
    m_qstrRoadId = qstrRoadId;
}

std::string LaneItem::getRoadType() const
{
    return m_qstrRoadType;
}

void LaneItem::setRoadType(const std::string &strRoadType)
{
    m_qstrRoadType = strRoadType;
}

